import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.net.UnknownHostException;

import javax.swing.*;


public class clientGUI {
		JFrame frame;
		JButton btn;
		//Controls
		JPanel controls;
		JPanel imagePanel;
		GridLayout cLayout;
		GridBagConstraints con;
		JButton forward;
		JButton backward;
		JButton left;
		JButton right;
		JButton autoPilot;
		static clientNetworkHandler net;
		
	public clientGUI(clientNetworkHandler net) throws IOException {
		this.net = net;
		controls = new JPanel();
		imagePanel = new ImagePanel(net);
		cLayout = new GridLayout(3,3);
		forward = new JButton("F");
		backward = new JButton("B");
		left = new JButton("L");
		right = new JButton("R");
		autoPilot = new JButton("A");
		
		controls.setLayout(cLayout);
		controls.add(new JLabel(""));
		controls.add(forward);
		controls.add(new JLabel(""));
		controls.add(left);
		controls.add(autoPilot);
		controls.add(right);
		controls.add(new JLabel(""));
		controls.add(backward);
		controls.add(new JLabel(""));
	
		Thread thread = new Thread((Runnable) imagePanel);
		thread.start();  
		    
		JFrame frame = new JFrame("Group 2 - Client");
		con = new GridBagConstraints();
		frame.setLayout(cLayout);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		con.fill = GridBagConstraints.NORTH;
		frame.add(imagePanel, con);
		con.fill = GridBagConstraints.SOUTH;
		frame.add(controls, con);
		//frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
		//frame.add(controls);
		controls.setSize(new Dimension(100,100));
		frame.pack();
		frame.setSize(600, 480);
		frame.setVisible(true);	
	}
	   // Button event handler
	   static class ButtonListener implements ActionListener {
	      public void actionPerformed(ActionEvent e) {
	         System.out.println("derp");
	      }
	   }
}
